* Add two conditional functions date_default_timezone_get() and date_default_timezone_set()
which are created if they are not available (PHP <5.1.0).
* Replace setenv( TZ= ) and getenv( TZ ) calls with date_default_timezone_get( TZ ) and
date_default_timezone_set( TZ ).
* Remove some warning supression calls, they were suppressing an E_STRICT level error that
is thrown in PHP >5.1.0, however the above changes stop that error from ever occurring
in the first place.
* Alter comment in DefaultSettings.php to refer to this function rather than the old
method of using setenv().
* Add item to RELEASE-NOTES bug fixes section and fix line width of one item.
Based on attachment 2577 by nekocue.
* (bug 13095) Search by first letters or digits in [[Special:Categories]]
* Users moving a page can now move all subpages automatically as well
* Sidebar is now cached for all languages
-* (bug 14259) Localisation message for upload button on Special:Import is now 'import-upload'
- instead of 'upload'
+* (bug 14259) Localisation message for upload button on Special:Import is now
+ 'import-upload' instead of 'upload'
=== Bug fixes in 1.13 ===
disabling $wgStrictFileExtensions
* (bug 14241) Pages can no longer be protected to levels you are not in
* (bug 14296) Fix local name of ang: (Anglo-Saxon)
+* (bug 7715) Use date_default_timezone_* instead of TZ environment variable if
+ available
=== API changes in 1.13 ===
* this in conjunction with the signature timezone and override the TZ
* environment variable like so:
* $wgLocaltimezone="Europe/Berlin";
- * putenv("TZ=$wgLocaltimezone");
+ * date_default_timezone_set( $wgLocaltimezone );
* $wgLocalTZoffset = date("Z") / 60;
*
* Leave at NULL to show times in universal time (UTC/GMT).
}
}
+if ( !function_exists( 'date_default_timezone_get' ) ) {
+ /**
+ * Exists in PHP 5.1.0+
+ * Simulates functionality partially.
+ * @return String: Environment timezone.
+ */
+ function date_default_timezone_get() {
+ return getenv( 'TZ' );
+ }
+}
+if ( !function_exists( 'date_default_timezone_set' ) ) {
+ /**
+ * Exists in PHP 5.1.0+
+ * Simulates functionality partially.
+ * @param String: Timezone to set to.
+ * @return Boolean: Indication regarding if setting was successful.
+ */
+ function date_default_timezone_set( $setting ) {
+ return putenv( 'TZ=' . $setting );
+ }
+}
+
/**
* Like array_diff( $a, $b ) except that it works with two-dimensional arrays.
*/
# Use the time zone
global $wgLocaltimezone;
if ( isset( $wgLocaltimezone ) ) {
- $oldtz = getenv( 'TZ' );
- putenv( 'TZ='.$wgLocaltimezone );
+ $oldtz = date_default_timezone_get();
+ date_default_timezone_set( $wgLocaltimezone );
}
- wfSuppressWarnings(); // E_STRICT system time bitching
$localTimestamp = date( 'YmdHis', $ts );
$localMonth = date( 'm', $ts );
$localMonthName = date( 'n', $ts );
$localYear = date( 'Y', $ts );
$localHour = date( 'H', $ts );
if ( isset( $wgLocaltimezone ) ) {
- putenv( 'TZ='.$oldtz );
+ date_default_timezone_set( $oldtz );
}
- wfRestoreWarnings();
switch ( $index ) {
case 'currentmonth':
$tz = 'UTC';
if ( isset( $wgLocaltimezone ) ) {
$unixts = wfTimestamp( TS_UNIX, $ts );
- $oldtz = getenv( 'TZ' );
- putenv( 'TZ='.$wgLocaltimezone );
+ $oldtz = date_default_timezone_get();
+ date_default_timezone_set( $wgLocaltimezone );
$ts = date( 'YmdHis', $unixts );
$tz = date( 'T', $unixts ); # might vary on DST changeover!
- putenv( 'TZ='.$oldtz );
+ date_default_timezone_set( $oldtz );
}
$d = $wgContLang->timeanddate( $ts, false, false ) . " ($tz)";
# Use the time zone
global $wgLocaltimezone;
if ( isset( $wgLocaltimezone ) ) {
- $oldtz = getenv( 'TZ' );
- putenv( 'TZ='.$wgLocaltimezone );
+ $oldtz = date_default_timezone_get();
+ date_default_timezone_set( $wgLocaltimezone );
}
- wfSuppressWarnings(); // E_STRICT system time bitching
$localTimestamp = date( 'YmdHis', $ts );
$localMonth = date( 'm', $ts );
$localMonthName = date( 'n', $ts );
$localYear = date( 'Y', $ts );
$localHour = date( 'H', $ts );
if ( isset( $wgLocaltimezone ) ) {
- putenv( 'TZ='.$oldtz );
+ date_default_timezone_set( $oldtz );
}
- wfRestoreWarnings();
switch ( $index ) {
case 'currentmonth':
* than the one selected in each user's preferences.
*/
if ( isset( $wgLocaltimezone ) ) {
- $oldtz = getenv( 'TZ' );
- putenv( 'TZ='.$wgLocaltimezone );
+ $oldtz = date_default_timezone_get();
+ date_default_timezone_set( $wgLocaltimezone );
}
$d = $wgContLang->timeanddate( date( 'YmdHis' ), false, false) .
' (' . date( 'T' ) . ')';
if ( isset( $wgLocaltimezone ) ) {
- putenv( 'TZ='.$oldtz );
+ date_default_timezone_set( $oldtz );
}
# Variable replacement